{include file="public/header" select="0" /}
<body>
<div class="header">
    <i class="layui-icon layui-icon-left" onclick="load_href('{:url(\'user/index\')}',2)"></i> 我要提现
</div>
<div class="recharge-price">
    <img src="/static/index/img/icon21.png" alt="">
    <div>
        <p>{:get_pay_way('bonus')}</p>
        <p class="num">￥<span>{$user->assets->bonus}</span></p>
    </div>
</div>
<form action="{:url('draw/save')}" method="post" class="form layui-form">
    <input type="hidden" name="account" value="bonus">
    <input type="hidden" name="mode" id="mode" value="银行卡">
    <input type="hidden" id="cost" value="{:cache('system')['draw_cost']}">
    <div class="recharge-title">支付方式</div>
    <ul class="recharge-nav flex-layout">
        <li class="active" data-type="银行卡">
            <p class="flex-center">
                <img src="/static/index/img/icon17.png" alt="">
            </p>
            <p>银行卡</p>
            <img src="/static/index/img/icon22.png" alt="" class="img">
        </li>
        <li data-type="微信">
            <p class="flex-center">
                <img src="/static/index/img/icon3.png" alt="">
            </p>
            <p>微信</p>
            <img src="/static/index/img/icon22.png" alt="" class="check-img img">
        </li>
        <li data-type="支付宝">
            <p class="flex-center">
                <img src="/static/index/img/icon4.png" alt="">
            </p>
            <p>支付宝</p>
            <img src="/static/index/img/icon22.png" alt="" class="check-img img">
        </li>
    </ul>
    <div class="recharge-bank">
        {if $user.bank_number}
        <p>{$user.bank_number}</p>
        <div>
            <p class="flex-center">
                <img src="/static/index/img/icon17.png" alt="">
            </p>
            <span>{$user.bank_name} | {$user.bank_account_name}</span>
        </div>
        <div>
            <span>{$user.bank_open}</span>
        </div>
        {else}
        <a href="{:url('user/method',['type'=>'bank','go_back'=>1])}" style="text-align:center;color: #8D8D8D">暂未绑定，点击去绑定</a>
        {/if}
    </div>

    <div class="recharge-imgs flex-center recharge-wechat" style="display:none;">
        {if $user.wechat_image}
        <p class="flex-center">
            <img src="{$user.wechat_image}" alt="">
        </p>
        <p>真实姓名：{$user.wechat_name}</p>
        {else}
        <a href="{:url('user/method',['type'=>'wechat','go_back'=>1])}" style="color: #8D8D8D">暂未绑定，点击去绑定</a>
        {/if}
    </div>

    <div class="recharge-imgs flex-center recharge-alipay" style="display:none;">
        {if $user.alipay_image}
        <p class="flex-center">
            <img src="{$user.alipay_image}" alt="">
        </p>
        <p>真实姓名：{$user.alipay_name}</p>
        {else}
        <a href="{:url('user/method',['type'=>'alipay','go_back'=>1])}" style="color: #8D8D8D">暂未绑定，点击去绑定</a>
        {/if}
    </div>

    <ul class="recharge-acc-list">
        {if cache('system')['draw_cost'] > 0}
        <li>
            <p>手续费</p>
            <div>
                <input type="text" value="{:cache('system')['draw_cost']*100}%" readonly>
            </div>
        </li>
        {/if}
        <li>
            <p>提现金额</p>
            <div>￥
                <input type="number" name="amount" id="amount" lay-verify="required" lay-reqtext="请输入提现金额"
                       placeholder="请输入提现金额，{:cache('system')['draw_min']}起提" autocomplete="off"
                       onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
            </div>
        </li>
        <li class="real_amount" style="display: none;">
            <p>实际到账金额</p>
            <div>
                <input type="text" id="real_amount" placeholder="实际到账金额" autocomplete="off" readonly>
            </div>
        </li>
        <li>
            <p>支付密码</p>
            <div>
                <input type="password" name="pay_password" lay-verify="required" lay-reqtext="请输入支付密码"
                       placeholder="请输入支付密码">
            </div>
        </li>
        <li></li>
    </ul>
    {if !$user.bank_number && !$user.wechat_image && !$user.alipay_image}
    <p class="save upd-save" style="background: #8D8D8D!important;" onclick="load_href('{:url(\'user/method_list\')}',2)">请先完善收款方式</p>
    {else}
    <p class="save upd-save" lay-submit lay-filter="save" formObj=".form">申请提现</p>
    {/if}
</form>
<div class="flex-center">
    <a href="{:url('draw/record')}" class="transfer-rec">提现记录
        <img src="/static/index/img/icon20.png" alt="">
    </a>
</div>
{include file="public/footer" select="0" /}
<script>
    $('.recharge-nav li').click(function() {
        var type = $(this).attr('data-type');
        switch (type) {
            case "银行卡":
                $('.recharge-bank').show();
                $('.recharge-alipay').hide();
                $('.recharge-wechat').hide();
                break;
            case "微信":
                $('.recharge-wechat').show();
                $('.recharge-bank').hide();
                $('.recharge-alipay').hide();
                break;
            case "支付宝":
                $('.recharge-alipay').show();
                $('.recharge-bank').hide();
                $('.recharge-wechat').hide();
                break;
            default:
                $('.recharge-bank').hide();
                $('.recharge-alipay').hide();
                $('.recharge-wechat').hide();
        }
        $('#mode').val(type);
        $(this).addClass('active').siblings().removeClass('active')
        $(this).find('.img').show().parent().siblings().find('.img').hide()
    });

    $('#amount').blur(function () {
        var value = $(this).val();
        if (value) {
            var cost = $('#cost').val();
            amount = (parseFloat(value) * (1 - parseFloat(cost))).toFixed(2);
            $('#real_amount').val(amount);
            $(".real_amount").show();
        } else {
            $(".real_amount").hide();
        }
    });
</script>
</body>
</html>